<?php
namespace app\controller;

use app\BaseController;

class Base extends BaseController
{

    protected $redis;

    public function initialize()
    {
        parent::initialize();
        try {
            $this->redis = new \Redis();
            $this->redis->connect('127.0.0.1', 6379);
            $this->redis->auth('root'); //设置密码
            $this->redis->select(0); //切换db库
        } catch (\Throwable $th) {
            // halt('redis初始化启动失败');
        }
    }

}
